import {
  UserLayout,
  BasicLayout,
  RouteView,
  PageView,
  BlankLayout
} from '@c/layouts'

export const user_login_path = '/user/login'
export const user_register_path = '/user/register'
export const user_register_result_path = '/user/register-result'

// 白名单地址，不需要重定向直接访问
export const whiteList = [
  user_login_path,
  user_register_path,
  user_register_result_path
]

// 基础路由 (匿名访问路由)
export const basicsRouterMap = [

  { // 登录 & 注册
    path: '/user',
    name: 'user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: '/user/login',
        name: 'login',
        component: () => import('@v/user/user-login')
      },
      {
        path: '/user/register',
        name: 'register',
        component: () => import('@v/user/user-register')
      },
      {
        path: '/user/register-result',
        name: 'register-result',
        component: () => import('@v/user/user-register-result')
      }
    ]
  },

  {
    path: '/404',
    component: () => import('@v/error/error-404')
  }
]

// 异步路由(根据用户权限动态添加) ---> 此处基本上都是菜单栏定义
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/board/analysis',
    children: [
      // board
      {
        path: '/board',
        name: 'board',
        component: () => import('@c/layouts/RouteView'),
        meta: { title: '仪表盘', icon: 'dashboard' },
        redirect: '/board/analysis',
        children: [
          {
            path: '/board/analysis',
            name: 'Analysis',
            component: () => import('@/views/board/Analysis'),
            meta: { title: '分析页' }
          },
          {
            path: '/board/monitor',
            name: 'Monitor',
            hidden: true,
            component: () => import('@/views/board/Monitor'),
            meta: { title: '监控页' }
          }
        ]
      },

      // 久康课堂
      {
        path: '/lesson',
        name: 'lesson',
        component: () => import('@c/layouts/RouteView'),
        meta: { title: '久康课堂', icon: 'video-camera' },
        redirect: '/lesson/course',
        children: [
          {
            path: '/lesson/course',
            name: 'lesson_course',
            component: () => import('@/views/lesson/LessonCourse'),
            meta: { title: '课程栏目', hiddenHeaderContent: false }
          },
          {
            path: '/lesson/live',
            name: 'lesson_live',
            hidden: true,
            component: () => import('@/views/lesson/LessonLive'),
            meta: { title: '课程直播', hiddenHeaderContent: true }
          },
          {
            path: '/lesson/qrcode',
            name: 'lesson_qrcode',
            // hidden: false,
            component: () => import('@/views/lesson/Qrcode'),
            meta: { title: '二维码', hiddenHeaderContent: false }
          }
        ]
      },

      // 个人中心
      {
        path: '/account',
        name: 'account',
        component: () => import('@c/layouts/RouteView'),
        meta: { title: '个人设置', icon: 'user' },
        redirect: '/account/center',
        children: [
          {
            path: '/account/center',
            name: 'center',
            component: () => import('@/views/account/center/Center'),
            meta: { title: '个人中心' }
          },
          {
            path: '/account/settings',
            name: 'settings',
            // hidden: false,
            component: () => import('@/views/account/setting/Settings'),
            meta: { title: '账号设置' }
          }
        ]
      },

      // result
      {
        path: '/result',
        name: 'result',
        component: PageView,
        meta: { title: '结果页', icon: 'check-circle-o' },
        redirect: '/result/success',
        children: [
          {
            path: '/result/success',
            name: 'result-success',
            component: () => import('@/views/result/result-success'),
            meta: { title: '成功', hiddenHeaderContent: true }
          },
          {
            path: '/result/fail',
            name: 'result-fail',
            component: () => import('@/views/result/result-error'),
            meta: { title: '失败', hiddenHeaderContent: true }
          }
        ]
      },

      { // 错误
        path: '/error',
        name: 'error',
        component: RouteView,
        meta: { title: '异常页', icon: 'warning' },
        redirect: '/error/403',
        children: [
          {
            path: '/error/403',
            name: 'error-403',
            component: () => import('@v/error/error-403'),
            meta: { title: '403' }
          },
          {
            path: '/error/404',
            name: 'error-404',
            component: () => import('@v/error/error-404'),
            meta: { title: '404' }
          },
          {
            path: '/error/500',
            name: 'error-500',
            component: () => import('@v/error/error-500'),
            meta: { title: '500' }
          }
        ]
      }
    ]
  },

  {
    path: '*', redirect: '/404', hidden: true
  }
]
